#include <stdio.h>
#include <map>
#include <time.h>
#include <ctime>
#include <stdlib.h>

using namespace std;

int main(){
	map<float, int> count;
	map<float, int>::iterator it;

	srand((unsigned)time(0)); 
	int v[20];
	for(int i =0; i < 20; i++){
		v[i] = rand() % 100;
		printf("%d ", v[i]);
	}
	printf("\n");


	for(int i=0; i<20;i++){
		if(count.find(v[i]) == count.end()) {
			count[v[i]] = 0;
		}else{
			count[v[i]]++;
		}
	}

	int p = 0;
	for(it = count.begin(); it != count.end(); it++){
		printf("%f : %d\n", it->first, it->second);
		v[p] = it->first;
		p++;
		for(int s=0; s< it->second; s++){
			v[p] = it->first;
			p++;
		}
	}

	for(int i = 0; i < 20; i++){
		printf("%d ", v[i]);
	}
	printf("\n");

	return 0;
}
